package shapewar.view.indvidul;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import shapewar.engine.ext.SkillColder;
import shapewar.engine.presenter.Presenter;
import shapewar.view.myview.MyView;

public class SkillColderView extends MyView{
	private SkillColder sc;
	float per_width = 50;
	float per_height = 50;
	float span_width = 10;
	public SkillColderView(Presenter pst,SkillColder sc) {
		super(pst, null);
		this.sc = sc;
	}
	int tm = 0;
	@Override
	protected void onDraw(Canvas canvas) {
		int d1 = sc.getFireColdFinishPercent();
		int d2 = sc.getFlashColdFinishPercent();
		
		if(d1<100){
			Paint paint = new Paint();
			paint.setColor(Color.RED);
			paint.setAlpha((int)(255*1f*(100-d1)/100));
			canvas.drawRect(sc.left, sc.top, sc.left+per_width, sc.top+per_height, paint);
			paint.setTextSize(20);
			paint.setColor(Color.BLACK);
			paint.setAlpha(255);
			canvas.drawText(d1+"%", sc.left+per_width/2-paint.measureText(d1+"%")/2, sc.top+per_height/2+paint.measureText(""+d1)/2, paint);
		}
		
		if(d2<100){
			Paint paint = new Paint();
			paint.setColor(Color.RED);
			paint.setAlpha((int)(255*1f*(100-d2)/100));
			canvas.drawRect(sc.left+per_width+span_width, sc.top, sc.left+span_width+per_width*2, sc.top+per_height, paint);
			paint.setTextSize(20);
			paint.setColor(Color.BLACK);
			paint.setAlpha(255);
			canvas.drawText(d2+"%", sc.left+per_width/2*3+10-paint.measureText(d2+"%")/2, sc.top+per_height/2+paint.measureText(""+d1)/2, paint);
		}
	}
	
}
